package com.cqc.other.designPattern.strategyPattern.strategy1;

/**
 * @author cui
 * @date 2024/10/25 19:36
 * @description STEP 2： 实现具体策略
 **/
public class PremiumPremiumStrategy implements PremiumStrategy{

    private final double baseRate;
    private final double additionalRate;

    public PremiumPremiumStrategy(double baseRate, double additionalRate) {
        this.baseRate = baseRate;
        this.additionalRate = additionalRate;
    }

    @Override
    public double calculate(boolean hasPreExistingConditions) {
        return hasPreExistingConditions?  additionalRate:  baseRate;
    }
}
